package com.youaishujuhui.devops.web.vo;

/**
 * 
* @Description:  结果对象
* @author chendongming
* @date 2018年5月15日 下午8:33:25
*
 */
public class Result<E> {
	
	public static int SUCCESS = 200;//成功
	public static int FAIL  = 900;//失败
	public static int SYS_FAIL  = 500;//系统异常
	public static int LOGIN_FAIL  = 1000;//登陆错误
	public static int AUTH_FAIL  = 2000;//权限错误
	
	private Page page;
	private E data;
	private int code;
	private String msg;
	
	
	public Page getPage() {
		return page;
	}
	public void setPage(Page page) {
		this.page = page;
	}
	public E getData() {
		return data;
	}
	public void setData(E data) {
		this.data = data;
	}
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	
	public static <E> Result<E> success(E data){
		Result<E> result = new Result<E>();
		result.setData(data);
		result.setCode(SUCCESS);
		return result;
	}
	
	public static <E> Result<E> fail(E data){
		Result<E> result = new Result<E>();
		result.setData(data);
		result.setCode(FAIL);
		return result;
	}
	
}
